
{extend name='public/base' /}

{block name="content"}

<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <form action="" class="layui-form" method="get">
                <div class="layui-form-item layui-form-pane">

                    <div class="layui-inline">
                        <label class="layui-form-label">日期范围：</label>
                        <div class="layui-input-inline">
                            <input name="both_time" class="layui-input" id="both_time" value="" type="text" placeholder="请选择开课日期">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <button class="layui-btn icon-btn layui-btn-sm" data-id="table_id" lay-filter="search" lay-submit="">
                            <i class="layui-icon"></i>搜索
                        </button>
                        <button type="reset" class="layui-btn icon-btn layui-btn-normal layui-btn-sm"><i class="layui-icon layui-icon-refresh"></i>{:__('Reset')}</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="layui-col-md12">
    <div class="layui-col-md4 index-box">
        <div class="layui-card">
            <div class="layui-card-header">
                注册学员数
                <span class="layui-badge layui-bg-blue layuiadmin-badge">今天</span>
            </div>
            <div class="layui-card-body layuiadmin-card-list">
                <p class="layuiadmin-big-font" id='allCount'>{$registerStudent}</p>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 index-box">
        <div class="layui-card">
            <div class="layui-card-header">
                报名学员数
                <span class="layui-badge layui-bg-cyan layuiadmin-badge">今天</span>
            </div>
            <div class="layui-card-body layuiadmin-card-list">
                <p class="layuiadmin-big-font" id='todayCount'>{$reportStudent}</p>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 index-box">
        <div class="layui-card">
            <div class="layui-card-header">
                缴费金额数（元）
                <span class="layui-badge layui-bg-green layuiadmin-badge">今天</span>
            </div>
            <div class="layui-card-body layuiadmin-card-list">

                <p class="layuiadmin-big-font" id='scoreCount'>{$price}</p>
            </div>
        </div>
    </div>
</div>


<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <table class="layui-hide" id="table_id" lay-filter="table_id"></table>
        </div>
    </div>

</div>
{/block}

{block name="js"} <!--js处理区-->


<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button type="button" lay-event="add"  class="layui-btn {:node('Admin/addAdmin')} layui-btn-sm">添加类别</button>
        <button type="button" lay-event="del"  class="layui-btn {:node('Admin/del')} layui-btn-sm layui-btn-danger">删除类别</button>
        <button type="button" lay-event="reload"  class="layui-btn  layui-btn-sm  layui-btn-primary">刷新表格</button>
    </div>
</script>


<script type="text/html" id="operationTpl">
    {{# if(d.id==0){ }}
     不可编辑
    {{# }else{ }}
    <a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs {:node('Admin/addAdmin')}" data-title="编辑类别" lay-event="edit"><i class="layui-icon"></i></a>
    <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs {:node('Admin/del')}" data-title="删除类别" lay-event="del"><i class="layui-icon "></i></a>
    {{# } }}
</script>

<script>
    layui.use(['element', 'table', 'form', 'jquery', 'lucky','opTable','laydate'], function () {
        var element = layui.element;
        var form = layui.form;
        var table = layui.table;
        var $ = layui.jquery;
        var lucky=layui.lucky;
        var opTable = layui.opTable;
        var laydate = layui.laydate;
        form.render();
        //日期范围
        laydate.render({
            elem: '#both_time'
            ,range: true
        });
        var myTables = table.render({
            elem: '#table_id',
            url:"{:url('index')}",
            toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
            defaultToolbar: ['filter', 'exports', 'print'],
            even: true, //开启隔行背景
            id:'table_id',
              // height: 'full-100',100',
            text: {
                none: '暂无相关数据'
            },
            cols: [[
                {type:'checkbox'},
                {field: 'id',  title: '序号',width:60},
                {field: 'date', title: '日期'},
                {field: 'student', title: '注册学员数',align: 'center',width:120,sort:true},
                {field: 'report', title: '报名人数',align: 'center',width:120,sort:true},
                {field: 'price', title: '交费金额(元)',align: 'center',width:120,sort:true},
                {field: 'refund', title: '退费数量',align: 'center',width:120,sort:true},
                {field: 'refund_price', title: '退费金额',align: 'center',width:120,sort:true},
            ]],
            done: function (res) {
                layer.closeAll('loading');
            }
        });


        /**
         * 监听单行工具操作
         */
        table.on('tool(table_id)', function (obj) {
            var data = obj.data;
            var _id=parseInt(data.id);
            var layEvent = obj.event;
            if(layEvent==="edit"){
                var urls="{:url('add')}?id="+_id;
                lucky.CreateOpenForm("编辑类别",urls,'40%');

            }else if(layEvent==="del"){
                lucky.FormatData(_id,"{:url('del')}");
            }
        });



        table.on('toolbar(table_id)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            if(obj.event==="add"){
                lucky.CreateOpenForm("添加类别","{:url('add')}",'40%');
                return false;
            }else if(obj.event==="close"){
                opTables.closeAll();
            }else if(obj.event==="open"){
                opTables.openAll();
            }else if(obj.event==="reload"){
                lucky.CreateReload();
            }else if(obj.event==="del"){
                var num=0;
                var id=[];
                for (var i in data) {
                    num++;
                    id.push(data[i].id);
                }
                if (num<1) {
                    layer.msg("请选择一项",{time:1500});return false;
                }
                lucky.FormatData(id,"{:url('del')}");
                return  false;
            }
        });

        /**
         * 关键词搜索树
         */
        form.on('submit(search)', function (obj) {
            lucky.CreateSearch(obj.field);
            return false;
        });
    });

</script >

{/block}
